﻿using System;
using System.Collections.Generic;
using System.Text;
using SGIPSPManager.Domain;
using Spring.Data.Generic;
using System.Data;

namespace SGIPSPManager.DAOImpl
{
    public class SPUserRowMapper : IRowMapper<SPUser>
    {
        #region IRowMapper<SPUser> Members

        public SPUser MapRow(IDataReader reader, int rowNum)
        {
            SPUser user = new SPUser();
            if (reader["ID"] != null)
                user.ID = new Guid(reader["ID"].ToString());
            if (reader["NodeId"] != null)
                user.NodeID = reader["NodeId"].ToString();
            if (reader["Password"] != null)
                user.Password = reader["Password"].ToString();
            if (reader["ScrID"] != null)
                user.ScrID = reader["ScrID"].ToString();
            if (reader["SPID"] != null)
                user.SPID = reader["SPID"].ToString();
            if (reader["SPName"] != null)
                user.SPName = reader["SPName"].ToString();
            if (reader["UserName"] != null)
                user.UserName = reader["UserName"].ToString();
            return user;
        }

        #endregion
    }
}
